package vm

func signExtend(x uint16, bitCount int) uint16 {
	if (x >> (bitCount - 1) & 1) == 1 {
		x |= (0xFFFF << bitCount)
	}
	return x
}

func swap16(x uint16) uint16 {
	return (x << 8) | (x >> 8)
}
